[XEN] Make the compat-mode l4 page table look more like a page table
authorTim Deegan <Tim.Deegan@xensource.com>
Wed, 28 Feb 2007 13:17:27 +0000 (13:17 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Wed, 28 Feb 2007 13:17:27 +0000 (13:17 +0000)
and remove some special-case code in the shadows.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
xen/arch/x86/domain.c
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/multi.c

index 65164c10b30e632b4778aa2e9497749e7deb5226..1582113057d6bcf53e9f9bd47d0c79a58d651b4d 100644 (file)
@@ -229,6 +229,10 @@ static int setup_compat_l4(struct vcpu *v)
 
     if ( !pg )
         return -ENOMEM;
+
+    /* This page needs to look like a pagetable so that it can be shadowed */
+    pg->u.inuse.type_info = PGT_l4_page_table|PGT_validated;
+
     l4tab = copy_page(page_to_virt(pg), idle_pg_table);
     l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] =
         l4e_from_page(pg, __PAGE_HYPERVISOR);
index 93233c83fc82b9e5eeb89605d2a6d3da8a92f07c..0c66bc18cf3fab245dc5f24a3057618b8ca1d5e0 100644 (file)
@@ -489,11 +489,7 @@ void shadow_demote(struct vcpu *v, mfn_t gmfn, u32 type)
 {
     struct page_info *page = mfn_to_page(gmfn);
 
-#ifdef CONFIG_COMPAT
-    if ( !IS_COMPAT(v->domain) || type != SH_type_l4_64_shadow )
-#endif
-        ASSERT(test_bit(_PGC_page_table, &page->count_info));
-
+    ASSERT(test_bit(_PGC_page_table, &page->count_info));
     ASSERT(test_bit(type, &page->shadow_flags));
 
     clear_bit(type, &page->shadow_flags);
@@ -1625,6 +1621,7 @@ void sh_destroy_shadow(struct vcpu *v, mfn_t smfn)
         break;
     case SH_type_l2h_64_shadow:
         ASSERT( IS_COMPAT(v->domain) );
+        /* Fall through... */
     case SH_type_l2_64_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4, 4)(v, smfn);
         break;
index e96972a9d5ea59110862e91b5563646f7c6ab971..328656a58e01509fca269c1d72fbe4cd058e320f 100644 (file)
@@ -3368,16 +3368,11 @@ sh_set_toplevel_shadow(struct vcpu *v,
     
 #if SHADOW_OPTIMIZATIONS & SHOPT_EARLY_UNSHADOW
     /* Once again OK to unhook entries from this table if we see fork/exit */
-#if CONFIG_PAGING_LEVELS == 4
-    if ( IS_COMPAT(d) )
-        ASSERT(!sh_mfn_is_a_page_table(gmfn));
-    else
-#endif
-        ASSERT(sh_mfn_is_a_page_table(gmfn));
+    ASSERT(sh_mfn_is_a_page_table(gmfn));
     mfn_to_page(gmfn)->shadow_flags &= ~SHF_unhooked_mappings;
 #endif
 
-    /* Pin the shadow and put it (back) on the list of top-level shadows */
+    /* Pin the shadow and put it (back) on the list of pinned shadows */
     if ( sh_pin(v, smfn) == 0 )
     {
         SHADOW_ERROR("can't pin %#lx as toplevel shadow\n", mfn_x(smfn));